'use strict';

module.exports = app => {
  app.beforeStart(async () => {
    console.log('Before app start...');
    if (app.config.env === 'local' || app.config.env === 'unittest') {
      // await app.model.sync()
      // { alter: true }
      // ↑↑↑ 需要新建表就执行，表创建完就注释掉，有新增字段就不行，需手动同步添加
      console.log('Models has been sync done....');
    }
  });

  app.on('error', err => {
    // report error
    err && console.log('err: ' + err);
  });

  app.on('request', ctx => {
    // log receive request
    // console.log('接受到请求: ' + Object.keys(ctx));
  });
};
